home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / pslib.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-11-21  |  8.3 KB  |  209 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8.                           pslib.h  -  description
  9.                              -------------------
  10.     begin                : Sat May 26 2001
  11.     copyright            : (C) 2001 by Franz Schmid
  12.     email                : Franz.Schmid@altmuehlnet.de
  13.  ***************************************************************************/
  14.  
  15. /***************************************************************************
  16.  *                                                                         *
  17.  *   This program is free software; you can redistribute it and/or modify  *
  18.  *   it under the terms of the GNU General Public License as published by  *
  19.  *   the Free Software Foundation; either version 2 of the License, or     *
  20.  *   (at your option) any later version.                                   *
  21.  *                                                                         *
  22.  ***************************************************************************/
  23.  
  24. #ifndef PSLIB_H
  25. #define PSLIB_H
  26.  
  27. #include <vector>
  28. #include <utility>
  29.  
  30. #include <QDataStream>
  31. #include <QFile>
  32. #include <QList>
  33. #include <QPen>
  34. #include <QString>
  35.  
  36. class ScribusDoc;
  37.  
  38. #include "page.h"
  39. #include "scribusapi.h"
  40. #include "scribusstructs.h"
  41. #include CMS_INC
  42.  
  43. #ifdef NLS_PROTO
  44. class ScText;
  45. #endif
  46.  
  47. class PageItem;
  48. class MultiProgressDialog;
  49. class ScImage;
  50.  
  51. /**
  52.   *@author Franz Schmid
  53.   * Diese Klasse erzeugt Postscript-Dateien
  54.   */
  55.  
  56. class SCRIBUS_API PSLib : public QObject
  57. {
  58.     Q_OBJECT
  59.     public:
  60.  
  61.         typedef enum
  62.         {
  63.             OptimizeCompat = 0,
  64.             OptimizeSize = 1
  65.         } Optimization;
  66.  
  67.         PSLib(PrintOptions &options, bool psart, SCFonts &AllFonts, QMap<QString, QMap<uint, FPointArray> > DocFonts, ColorList DocColors, bool pdf = false, bool spot = true);
  68.         virtual ~PSLib() {};
  69.  
  70.         void setOptimization (Optimization opt) { optimization = opt; }
  71.  
  72.         virtual int   CreatePS(ScribusDoc* Doc, PrintOptions &options);
  73.         virtual const QString& errorMessage(void);
  74.  
  75.         virtual void PS_Error(const QString& message);
  76.         virtual void PS_Error_ImageDataWriteFailure(void);
  77.         virtual void PS_Error_ImageLoadFailure(const QString& fileName);
  78.         virtual void PS_Error_MaskLoadFailure(const QString& fileName);
  79.         virtual void PS_Error_InsufficientMemory(void);
  80.  
  81.         virtual bool PS_set_file(QString fn);
  82.         virtual void PS_set_Info(QString art, QString was);
  83.         virtual bool PS_begin_doc(ScribusDoc *doc, double x, double y, double breite, double hoehe, int numpage, bool doDev, bool sep, bool farb, bool ic, bool gcr);
  84.         virtual void PS_begin_page(Page* pg, MarginStruct* Ma, bool Clipping);
  85.         virtual void PS_end_page();
  86.         virtual void PS_curve(double x1, double y1, double x2, double y2, double x3, double y3);
  87.         virtual void PS_moveto(double x, double y);
  88.         virtual void PS_lineto(double x, double y);
  89.         virtual void PS_closepath();
  90.         virtual void PS_translate(double x, double y);
  91.         virtual void PS_scale(double x, double y);
  92.         virtual void PS_rotate(double x);
  93.         virtual void PS_clip(bool mu);
  94.         virtual void PS_save();
  95.         virtual void PS_restore();
  96.         virtual void PS_setcmykcolor_fill(double c, double m, double y, double k);
  97.         virtual void PS_setcmykcolor_dummy();
  98.         virtual void PS_setcmykcolor_stroke(double c, double m, double y, double k);
  99.         virtual void PS_setlinewidth(double w);
  100.         virtual void PS_setcapjoin(Qt::PenCapStyle ca, Qt::PenJoinStyle jo);
  101.         virtual void PS_setdash(Qt::PenStyle st, double offset, QVector<double> dash);
  102.         virtual void PS_selectfont(QString f, double s);
  103.         virtual void PS_fill();
  104.         virtual void PS_fillspot(QString color, double shade);
  105.         virtual void PS_stroke();
  106.         virtual void PS_strokespot(QString color, double shade);
  107.         virtual void PS_fill_stroke();
  108.         virtual void PS_newpath();
  109.         virtual void PS_MultiRadGradient(double w, double h, double x, double y, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades);
  110.         virtual void PS_MultiLinGradient(double w, double h, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades);
  111.         virtual void PS_show(double x, double y);
  112.         virtual void PS_showSub(uint chr, QString font, double size, bool stroke);
  113.         virtual void PS_show_xyG(QString font, uint gl, double x, double y, QString colorName, double shade);
  114.         virtual bool PS_image(PageItem *c, double x, double y, QString fn, double scalex, double scaley, QString Prof, bool UseEmbedded, bool UseProf, QString Name = "");
  115.         virtual bool PS_ImageData(PageItem *c, QString fn, QString Name, QString Prof, bool UseEmbedded, bool UseProf);
  116.         virtual void PS_plate(int nr, QString name = "");
  117.         virtual void PS_setGray();
  118.         virtual void PDF_Bookmark(QString text, uint Seite);
  119.         virtual void PDF_Annotation(PageItem *item, QString text, double x, double y, double b, double h);
  120.         virtual void PS_close();
  121.         virtual void PS_insert(QString i);
  122.         virtual void PS_TemplateStart(QString Name);
  123.         virtual void PS_TemplateEnd();
  124.         virtual void PS_UseTemplate(QString Name);
  125.         virtual bool ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded = false, bool useTemplate = false);
  126.         virtual void ProcessPage(ScribusDoc* Doc, /*ScribusView* view,*/Page* a, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
  127.         virtual void drawArrow(PageItem *ite, QMatrix &arrowTrans, int arrowIndex, bool gcr);
  128.         virtual void putColor(const QString& color, double shade, bool fill);
  129.         virtual void putColorNoDraw(const QString& color, double shade, bool gcr);
  130.         virtual void GetBleeds(Page* page, double& left, double& right);
  131.         virtual void GetBleeds(Page* page, double& left, double& right, double& bottom, double& top);
  132.         virtual void SetClipPath(FPointArray *c, bool poly = true);
  133.         virtual void HandleGradient(PageItem *c, double w, double h, bool gcr);
  134.         virtual void SetColor(const QString& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
  135.         virtual void SetColor(const ScColor& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
  136.         virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, Page* pg, bool sep, bool farb, bool ic, bool master);
  137.         virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint a, uint d, ScText *hl, const ParagraphStyle& pstyle, Page* pg, bool sep, bool farb, bool ic, bool master);
  138.         bool Art;
  139.  
  140.     private:
  141.  
  142.         void PutStream (const QString& c);
  143.         void PutStream (const QByteArray& array, bool hexEnc);
  144.         void PutStream (const char* in, int length, bool hexEnc);
  145.  
  146.         bool PutImageToStream(ScImage& image, int plate);
  147.         bool PutImageToStream(ScImage& image, const QByteArray& mask, int plate);
  148.  
  149.         bool PutImageDataToStream(const QByteArray& image);
  150.         bool PutInterleavedImageMaskToStream(const QByteArray& image, const QByteArray& mask, bool gray);
  151.  
  152.         void WriteASCII85Bytes(const QByteArray& array);
  153.         void WriteASCII85Bytes(const unsigned char* array, int length);
  154.  
  155.         Optimization optimization;
  156.  
  157.         QString ToStr(double c);
  158.         QString IToStr(int c);
  159.         QString MatrixToStr(double m11, double m12, double m21, double m22, double x, double y);
  160.         QString PSEncode(QString in);
  161.         QString ErrorMessage;
  162.         QString Prolog;
  163.         QString Header;
  164.         QString Creator;
  165.         QString User;
  166.         QString Titel;
  167.         QString BBox;
  168.         QString BBoxH;
  169.         QString Farben;
  170.         QString FNamen;
  171.         QString PDev;
  172.         QString GrayCalc;
  173.         bool GraySc;
  174.         int Seiten;
  175.         QString FillColor;
  176.         QString StrokeColor;
  177.         double LineW;
  178.         QString Fonts;
  179.         QString FontDesc;
  180.         QMap<QString, QString> UsedFonts;
  181.         QMap<QString, QString> FontSubsetMap;
  182.         typedef QMap<uint, std::pair<QChar, QString> > GlyphList;
  183.         QMap<QString, GlyphList> GlyphsOfFont;
  184.         bool isPDF;
  185.         QFile Spool;
  186.         QDataStream spoolStream;
  187.         int  Plate;
  188.         bool DoSep;
  189.         bool useSpotColors;
  190.         bool fillRule;
  191.         bool applyICC;
  192.         cmsHTRANSFORM solidTransform;
  193.         QString currentSpot;
  194.         ColorList colorsToUse;
  195.         QString colorDesc;
  196.         ScribusDoc *m_Doc;
  197.         QMap<QString, QString> spotMap;
  198.         MultiProgressDialog* progressDialog;
  199.         bool usingGUI;
  200.         bool abortExport;
  201.         PrintOptions Options;
  202.         Page* ActPage;
  203.  
  204.     protected slots:
  205.         void cancelRequested();
  206. };
  207.  
  208. #endif
  209.